package snakesladers.view;

import javax.swing.JTextField;

import minidraw.boardgame.BoardDrawing;
import minidraw.framework.Drawing;
import minidraw.framework.DrawingEditor;
import minidraw.framework.DrawingView;
import minidraw.framework.Factory;
import minidraw.standard.StdViewWithBackground;
import snakesladders.domain.Game;
import snakesladders.domain.Square;

public class SnakesAndLaddersFactory implements Factory {
	private Game game;
	
	public SnakesAndLaddersFactory(Game game) {
	this.game = game;	
	}
	
	@Override
	public DrawingView createDrawingView(DrawingEditor editor) {

		DrawingView view = new StdViewWithBackground(editor, "snakes-and-ladders-background");
		return view;
	}
	
	@Override
	public Drawing createDrawing(DrawingEditor editor) {
//		return new StandardDrawing();
		return new BoardDrawing<Square>(new SnakeLaddersPieceFactory(game),
				new SnakeLaddersPositionStrategy(),
				new SnakesAndLaddersPropAppearanceStrategy(game));
	}

	@Override
	public JTextField createStatusField(DrawingEditor arg0) {
		JTextField statusField = new JTextField("Hello snakes....");
		statusField.setEditable(true);
		return statusField;
	}
	
}
